package com.wo.cloud.auth.service.impl;

import com.wo.cloud.auth.service.ValidateService;
import com.wo.cloud.auth.util.SmsConstant;
import com.wo.cloud.core.entity.Response;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.time.Duration;

/**
 * @author liry
 * @version 1.0
 * @date Created on 2021/5/25 15:57
 * Description:
 */

@Service
public class ValidateServiceImpl implements ValidateService {

    private RedisTemplate<String, Object> redisTemplate;

    @Override
    public Response<?> getSmsCode(String mobile) {
        String code = "1188";
        redisTemplate.opsForValue().set(SmsConstant.SMS_CODE_KEY + mobile, code, Duration.ofMinutes(5));
        return Response.success("发送成功");
    }
}
